import { mapGetters } from 'vuex';
import { getUserDetailApi } from './detail-user.service';
export default {
  name: 'detail-user',
  components: { },
  directives: {},
  props: {
    userId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      file_url: process.env.VUE_APP_FILE_URL, // 头像url
      loading: false, // table loading
      showDialog: true, // 是否显示弹窗
      title: '用户详情',
      editForm: {} // 编辑用户表单
    }
  },
  computed: {
    ...mapGetters([
      'codesCheck'
    ])
  },
  created() {
    this.getUserDetail();
  },
  methods: {
    // 获取详情
    getUserDetail() {
      getUserDetailApi(this.userId).then(res => {
        this.editForm = res.data;
      })
    },

    // 关闭dialog时需要告诉父组件隐藏弹窗
    closeDialog() {
      this.showDialog = false;
      this.$emit('close', true);
    }
  }
}
